﻿using System;

namespace FxCore.Base
{
    public class FxTile
    {
        public FxImage Image { get; }

        public TilePoint Position { get; }

        public static FxTile Empty;

        static FxTile()
        {
           Empty = new FxTile();
        }

        public FxTile()
        {
            this.Position = new TilePoint(0L, 0L);
            this.Image = FxImage.Empty;
        }

        public override int GetHashCode()
        {
            return Position.GetHashCode() ^ Image.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            FxTile tile = (FxTile) obj;
            if (tile == null)
            {
                throw new NullReferenceException();
            }

            return this.Image.Equals(tile.Image) && this.Position.Equals(tile.Position);
        }
    }
}
